package com.openness.example.hbase;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.hadoop.hbase.util.Bytes;

import com.openness.crawler.crawler.CrawlConfig;
import com.openness.crawler.hbase.HBaseTablePool;
import com.openness.crawler.hbase.HBaseUtil;

/**
 * @author Rain
 * @version 2013-5-30 下午4:34:59
 */

public class GetMain {

	public static void main(String[] args) throws IOException {
		CrawlConfig config = new CrawlConfig();

		config.setHbaseMaster("leaderman.rain.centos");

		config.setHbaseZooKeeperQuorum("leaderman.rain.centos");

		config.setHbaseZooKeeperPropertyClientPort("2181");

		config.setHbaseTablePoolSize(5);

		HBaseTablePool.initialize(config);

		List<byte[]> rows = new ArrayList<byte[]>();

		rows.add(Bytes.toBytes("1"));
		rows.add(Bytes.toBytes("2"));

		List<Map<String, byte[]>> results = HBaseUtil.getRows("student", rows);
		
		for(Map<String, byte[]> result : results){
			System.out.println(Bytes.toString(result.get("number")));
		}

		HBaseTablePool.shutdown();
	}

}
